/*
 * QApplicationDelegate.h  0.4.0 / Nov 17, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef QAPPLICATIONDELEGATE_H
#define QAPPLICATIONDELEGATE_H

#include "Cute4jSwing.h"

#include "QApplicationAdapter.h"

// QApplicationDelegate Class. -------------------------------------------------

/*!
 * \brief QApplication Delegate.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT QApplicationDelegate // TODO: check name - is it consistent ?
{
public:
  static void initialize(JNIEnv *env, jobjectArray args);
  static void dispose();
  static jint keyboardModifiers();
  static jint mouseButtons();
  static bool argvContains(const char *str);
  static bool argvContains(const char *str, int len);
public:
  inline static int argc();
  inline static char **argv();
  inline static QApplicationAdapter *qAppAdapterInstance();
private:
  static int sm_argc;
  static char **sm_argv;
  static QApplicationAdapter *qApplicationAdapter;
};

// QApplicationDelegate :: Public Static Inline Member Functions. --------------

/*!
 * \brief Returns argc.
 *
 * \return argc
 */
inline int QApplicationDelegate::argc()
{
  return sm_argc;
}

/*!
 * \brief Returns argv.
 *
 * \return argv
 */
inline char **QApplicationDelegate::argv()
{
  return sm_argv;
}

/*!
 * \brief Returns QApplicationAdapter instance.
 *
 * \return QApplicationAdapter instance
 */
inline QApplicationAdapter *QApplicationDelegate::qAppAdapterInstance()
{
  return qApplicationAdapter;
}

// Macro Definition. -----------------------------------------------------------

#define qAppAdapter (QApplicationDelegate::qAppAdapterInstance())

#endif // QAPPLICATIONDELEGATE_H
